package com.ruoyi.ap.service.impl;

import java.util.List;

import com.ruoyi.ap.pojo.vo.OrderVo;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ap.mapper.OrderMapper;
import com.ruoyi.ap.domain.Order;
import com.ruoyi.ap.service.IOrderService;

import javax.annotation.Resource;

/**
 * 销售单Service业务层处理
 * 
 * @author HuaQP
 * @date 2023-09-15
 */
@Service
public class OrderServiceImpl implements IOrderService 
{
    @Resource
    private OrderMapper orderMapper;

    /**
     * 查询销售单
     * 
     * @param id 销售单主键
     * @return 销售单
     */
    @Override
    public Order selectOrderById(Long id)
    {
        return orderMapper.selectOrderById(id);
    }

    /**
     * 查询销售单列表
     * 
     * @param order 销售单
     * @return 销售单
     */
    @Override
    public List<OrderVo> selectOrderList(OrderVo order)
    {
        return orderMapper.selectOrderList(order);
    }

    /**
     * 新增销售单
     * 
     * @param order 销售单
     * @return 结果
     */
    @Override
    public int insertOrder(Order order)
    {
        order.setCreateTime(DateUtils.getNowDate());
        return orderMapper.insertOrder(order);
    }

    /**
     * 修改销售单
     * 
     * @param order 销售单
     * @return 结果
     */
    @Override
    public int updateOrder(Order order)
    {
        order.setUpdateTime(DateUtils.getNowDate());
        return orderMapper.updateOrder(order);
    }

    /**
     * 批量删除销售单
     * 
     * @param ids 需要删除的销售单主键
     * @return 结果
     */
    @Override
    public int deleteOrderByIds(Long[] ids)
    {
        return orderMapper.deleteOrderByIds(ids);
    }

    /**
     * 删除销售单信息
     * 
     * @param id 销售单主键
     * @return 结果
     */
    @Override
    public int deleteOrderById(Long id)
    {
        return orderMapper.deleteOrderById(id);
    }
}
